package vistas.ui;
import java.awt.Component;
import java.awt.FlowLayout;

import java.awt.event.ActionEvent;
import java.util.Vector;

import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import controladores.ControladorBorrarCategoriaFrame;
import controladores.ControladorGenerarPresupuesto;
import controladores.ControladorModificarPresupuestoFrame;
import controladores.interfaces.ControladorAdministradorCategorias;
import controladores.interfaces.ControladorAdministradorPresupuestos;
import entidades.Categoria;
import entidades.Cliente;
import entidades.ItemPresupuesto;
import entidades.Presupuesto;

/**
 * This code was edited or generated using CloudGarden's Jigloo
 * SWT/Swing GUI Builder, which is free for non-commercial
 * use. If Jigloo is being used commercially (ie, by a corporation,
 * company or business for any purpose whatever) then you
 * should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details.
 * Use of Jigloo implies acceptance of these licensing terms.
 * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
 * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
 * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class ModificarPresupuestoFrame extends javax.swing.JInternalFrame {


	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JLabel lblBuscarCliente;
	private JTextField txtTelefono;
	private JLabel lblDireccion;
	private JLabel lblTelefono;
	private JLabel lblFax;
	private JLabel lblEmail;
	private JLabel lblTotal;
	private AbstractAction abstractAction7;
	private AbstractAction abstractAction6;
	private JComboBox cmbCategoria;
	private AbstractAction abstractAction1;
	private JButton btnCancelar;
	private JButton btnAceptar;
	private JTextField txtTotalPresupuesto;
	private JComboBox cmbCondicionPago;
	private JTextField txtValidez;
	private JLabel lblValidez;
	private JLabel lblCondicionPago;
	private JLabel lblCategoria;
	private JComboBox cmbCondicionPresupuesto;
	private JLabel lblCondicionPresupuesto;
	private JScrollPane jScrollPane1;
	private JTextArea textAreaListadoItems;
	private JLabel jLabel1;
	private JTextField txtNumeroPresupuesto;
	private JLabel lblNumeroPresupuesto;
	private JPanel PanelListadoItems;
	private JTextField txtEmail;
	private JTextField txtFax;
	private JTextField txtDireccion;
	private JLabel lblRazonSocial;
	private JTextField txtRazonSocial;
	private JLabel lblNombre;
	private JTextField txtNombre;
	private JTextField txtCuit;
	private JLabel lblCuit;
	private JPanel PanelDatosCliente;
	private JButton btnBuscarPresupuesto;
	private JTextField txtNroPresupuestoBuscado;
	private Presupuesto presupuestoEncontrado = new Presupuesto();
	private Vector<ItemPresupuesto> listadoItemsPresupuesto = new Vector<ItemPresupuesto>();

	/**
	 * Auto-generated main method to display this 
	 * JInternalFrame inside a new JFrame.
	 */
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		ModificarPresupuestoFrame inst = new ModificarPresupuestoFrame();
		JDesktopPane jdp = new JDesktopPane();
		jdp.add(inst);
		jdp.setPreferredSize(inst.getPreferredSize());
		frame.setContentPane(jdp);
		frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

	public ModificarPresupuestoFrame() {
		super();
		initGUI();
	}

	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(765, 426));
			this.setBounds(0, 0, 765, 426);
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setVisible(true);
			this.setTitle("Modificar estado presupuesto");
			{
				lblBuscarCliente = new JLabel();
				lblBuscarCliente.setText("Buscar Presupuesto:");
			}
			{
				txtNroPresupuestoBuscado = new JTextField();
			}
			{
				btnBuscarPresupuesto = new JButton();
				btnBuscarPresupuesto.setText("Buscar");
				btnBuscarPresupuesto.setAction(getAbstractAction1());
			}
			{
				PanelDatosCliente = new JPanel();
				GroupLayout PanelDatosClienteLayout = new GroupLayout((JComponent)PanelDatosCliente);
				PanelDatosCliente.setLayout(PanelDatosClienteLayout);
				PanelDatosCliente.setBorder(BorderFactory.createTitledBorder("Datos del cliente"));
				{
					lblCuit = new JLabel();
					lblCuit.setText("CUIT:");
				}
				{
					txtRazonSocial = new JTextField();
					txtRazonSocial.setEditable(false);
				}
				{
					lblRazonSocial = new JLabel();
					lblRazonSocial.setText("R. Social:");
				}
				{
					txtDireccion = new JTextField();
					txtDireccion.setEditable(false);
				}
				{
					lblDireccion = new JLabel();
					lblDireccion.setText("Direccion:");
				}
				{
					txtNombre = new JTextField();
					txtNombre.setEditable(false);
				}
				{
					lblNombre = new JLabel();
					lblNombre.setText("Nombre:");
				}
				{
					//					ComboBoxModel cmbCuitModel = 
					//							new DefaultComboBoxModel(
					//									new String[] { "Item One", "Item Two" });
					cmbCategoria = new JComboBox();
					//					cmbCategoria.setModel(cmbCuitModel);
					cmbCategoria.setEditable(false);
					ControladorAdministradorCategorias contCategorias = new ControladorBorrarCategoriaFrame();
					Vector<Categoria> categorias = new Vector<Categoria>();
					categorias = contCategorias.obtenerCategorias();
					for(Categoria cat : categorias){
						cmbCategoria.addItem(cat.getNombre());			
					}
				}
				{
					txtTelefono = new JTextField();
					txtTelefono.setEditable(false);
				}
				{
					lblTelefono = new JLabel();
					lblTelefono.setText("Telefono:");
				}
				{
					txtFax = new JTextField();
					txtFax.setEditable(false);
				}
				{
					lblFax = new JLabel();
					lblFax.setText("Fax:");
				}
				{
					txtEmail = new JTextField();
					txtEmail.setEditable(false);
				}
				{
					lblEmail = new JLabel();
					lblEmail.setText("E-mail:");
				}
				{
					lblCategoria = new JLabel();
					lblCategoria.setText("Categoria:");
				}
				{
					txtCuit = new JTextField();
					txtCuit.setEditable(false);
				}
				PanelDatosClienteLayout.setHorizontalGroup(PanelDatosClienteLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addComponent(lblRazonSocial, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblCuit, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblNombre, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE))
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addComponent(txtRazonSocial, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtCuit, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtNombre, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addComponent(lblTelefono, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblFax, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblEmail, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addGroup(PanelDatosClienteLayout.createSequentialGroup()
					        .addGroup(PanelDatosClienteLayout.createParallelGroup()
					            .addComponent(txtTelefono, GroupLayout.Alignment.LEADING, 0, 170, Short.MAX_VALUE)
					            .addComponent(txtFax, GroupLayout.Alignment.LEADING, 0, 170, Short.MAX_VALUE))
					        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					        .addGroup(PanelDatosClienteLayout.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, PanelDatosClienteLayout.createSequentialGroup()
					                .addComponent(lblDireccion, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					                .addGap(12))
					            .addComponent(lblCategoria, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE))
					        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					        .addGroup(PanelDatosClienteLayout.createParallelGroup()
					            .addComponent(txtDireccion, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 232, GroupLayout.PREFERRED_SIZE)
					            .addComponent(cmbCategoria, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 232, GroupLayout.PREFERRED_SIZE)))
					    .addComponent(txtEmail, GroupLayout.Alignment.LEADING, 0, 507, Short.MAX_VALUE))
					.addContainerGap(61, 61));
				PanelDatosClienteLayout.setVerticalGroup(PanelDatosClienteLayout.createSequentialGroup()
					.addGroup(PanelDatosClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(txtDireccion, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblDireccion, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtTelefono, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblTelefono, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtCuit, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblCuit, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(PanelDatosClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(cmbCategoria, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblCategoria, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtFax, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblFax, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtNombre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblNombre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(PanelDatosClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(lblEmail, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtEmail, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtRazonSocial, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblRazonSocial, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED));
				PanelDatosClienteLayout.linkSize(SwingConstants.VERTICAL, new Component[] {txtCuit, lblCuit});
			}
			{
				btnAceptar = new JButton();
				btnAceptar.setText("Aceptar");
				btnAceptar.setAction(getAbstractAction7());
			}
			{
				btnCancelar = new JButton();
				btnCancelar.setText("Cancelar");
				btnCancelar.setAction(getAbstractAction6());
			}
			{
				lblValidez = new JLabel();
				lblValidez.setText("Validez (dias): ");
			}
			{
				txtValidez = new JTextField();
				txtValidez.setText("");
				txtValidez.setEditable(false);
			}
			{
				ComboBoxModel cmbCondicionPagoModel = 
						new DefaultComboBoxModel(
								new String[] { "Contado", "Cheque 30 dias", "Cuenta Corriente" });
				cmbCondicionPago = new JComboBox();
				cmbCondicionPago.setModel(cmbCondicionPagoModel);
				cmbCondicionPago.setEditable(false);
				cmbCondicionPago.setEnabled(false);
			}
			{
				lblTotal = new JLabel();
				lblTotal.setText("Total:");
			}
			{
				txtTotalPresupuesto = new JTextField();
				txtTotalPresupuesto.setEditable(false);
			}
			{
				lblCondicionPago = new JLabel();
				lblCondicionPago.setText("Condicion de pago:");
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addComponent(getJLabel1x(), GroupLayout.PREFERRED_SIZE, 0, GroupLayout.PREFERRED_SIZE)
				.addGap(12)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(lblBuscarCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
				    .addComponent(txtNroPresupuestoBuscado, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(btnBuscarPresupuesto, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(PanelDatosCliente, GroupLayout.PREFERRED_SIZE, 109, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(getPanelListadoItems(), GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(lblTotal, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
				    .addComponent(txtTotalPresupuesto, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(lblValidez, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
				    .addComponent(txtValidez, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getLblCondicionPresupuesto(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
				    .addComponent(cmbCondicionPago, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(lblCondicionPago, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(btnAceptar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(btnCancelar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getCmbCondicionPresupuesto(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getTxtNumeroPresupuesto(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getLblNumeroPresupuesto(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addContainerGap(16, 16));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addComponent(getJLabel1x(), GroupLayout.PREFERRED_SIZE, 0, GroupLayout.PREFERRED_SIZE)
				.addGap(8)
				.addGroup(thisLayout.createParallelGroup()
				    .addGroup(thisLayout.createSequentialGroup()
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(getLblNumeroPresupuesto(), GroupLayout.PREFERRED_SIZE, 163, GroupLayout.PREFERRED_SIZE)
				                .addGroup(thisLayout.createParallelGroup()
				                    .addComponent(getTxtNumeroPresupuesto(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 154, GroupLayout.PREFERRED_SIZE)
				                    .addComponent(cmbCondicionPago, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE))
				                .addGap(18)
				                .addGroup(thisLayout.createParallelGroup()
				                    .addComponent(getCmbCondicionPresupuesto(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE)
				                    .addComponent(getLblCondicionPresupuesto(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE))
				                .addGap(23)
				                .addGroup(thisLayout.createParallelGroup()
				                    .addComponent(btnCancelar, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE)
				                    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                        .addComponent(lblValidez, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE)
				                        .addComponent(txtValidez, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
				                        .addGap(12))))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addGroup(thisLayout.createParallelGroup()
				                    .addComponent(lblCondicionPago, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 127, GroupLayout.PREFERRED_SIZE)
				                    .addComponent(lblBuscarCliente, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 127, GroupLayout.PREFERRED_SIZE))
				                .addComponent(txtNroPresupuestoBuscado, GroupLayout.PREFERRED_SIZE, 390, GroupLayout.PREFERRED_SIZE)
				                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				                .addComponent(btnBuscarPresupuesto, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)
				                .addGap(14)))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(thisLayout.createSequentialGroup()
				                .addComponent(btnAceptar, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 0, Short.MAX_VALUE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(lblTotal, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
				                .addComponent(txtTotalPresupuesto, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 8, Short.MAX_VALUE))))
				    .addComponent(PanelDatosCliente, GroupLayout.Alignment.LEADING, 0, 743, Short.MAX_VALUE)
				    .addComponent(getPanelListadoItems(), GroupLayout.Alignment.LEADING, 0, 743, Short.MAX_VALUE))
				.addContainerGap());
			thisLayout.linkSize(SwingConstants.VERTICAL, new Component[] {getLblCondicionPresupuesto(), cmbCondicionPago});
			thisLayout.linkSize(SwingConstants.VERTICAL, new Component[] {lblCondicionPago, txtValidez});
			thisLayout.linkSize(SwingConstants.VERTICAL, new Component[] {lblTotal, txtTotalPresupuesto});
			thisLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] {btnAceptar, btnCancelar});
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/*
	 * ------------------------------------------------------------------------------------------------
	 * 		Aqui arranca el manejo de los action listeners de los elementos emplazados en esta ventana
	 * ------------------------------------------------------------------------------------------------
	 */
	
	private AbstractAction getAbstractAction1() {
		if(abstractAction1 == null) {
			abstractAction1 = new AbstractAction("Buscar", null) {
				/**
				 * 
				 */
				private static final long serialVersionUID = 1L;

				public void actionPerformed(ActionEvent evt) {
					/*
					 *  Comienzo Action listeneer del boton Buscar presupuesto
					 */
					ControladorAdministradorPresupuestos controladorPresupuesto = new ControladorGenerarPresupuesto();
					
					if(txtNroPresupuestoBuscado.getText().equals("")){	// Caso -> NO ingresa datos de presupuesto (el campo esta en blanco)
						JOptionPane.showMessageDialog(null, "Debe de ingresar un nro de presupuesto");
					} 
					else {	// Caso -> SI ingresa datos (el campo no esta en blanco).
					
						// Presupuesto NO existe -> Se informa la inexistencia del mismo
						if( ! controladorPresupuesto.existePresupuesto(Integer.valueOf(txtNroPresupuestoBuscado.getText()))){
							JOptionPane.showMessageDialog(null, "El presupuesto " + txtNroPresupuestoBuscado.getText() + " \nno se encuentra cargado " +
									"\nen la base de datos\nIngrese los datos del mismo");
							txtNroPresupuestoBuscado.setText("");
						} 
						
						// Presupuesto SI existe -> Se cargan en pantalla los datos del mismo
						else {
							presupuestoEncontrado = controladorPresupuesto.getPresupuesto(Integer.valueOf(txtNroPresupuestoBuscado.getText()));							
							
							// Seteo datos del recuadro del cliente
							Cliente clienteBuscado = presupuestoEncontrado.getCliente();
							txtCuit.setText(clienteBuscado.getCuit());
							txtNombre.setText(clienteBuscado.getNombre());
							txtRazonSocial.setText(clienteBuscado.getRazonSocial());
							txtTelefono.setText(clienteBuscado.getTelefono());
							txtFax.setText(clienteBuscado.getFax());
							txtEmail.setText(clienteBuscado.getEmail());
							txtDireccion.setText(clienteBuscado.getDireccion());
							cmbCategoria.setSelectedItem(clienteBuscado.getCategoria());
							btnBuscarPresupuesto.setEnabled(false);
							txtNroPresupuestoBuscado.setEnabled(false);
							cmbCategoria.setEnabled(false);
							
							// Cargo los items del presupuesto en el listado
							listadoItemsPresupuesto = presupuestoEncontrado.getItemsPresupuesto();
							actualizarListado(listadoItemsPresupuesto);
							
							// Cargo los demas elementos de la ventana
							cmbCondicionPago.setSelectedItem(presupuestoEncontrado.getCondicionPago());
							txtNumeroPresupuesto.setText(String.valueOf(presupuestoEncontrado.getNroDocumento()));
							txtValidez.setText(String.valueOf(presupuestoEncontrado.getDiasValidez()));
							txtNroPresupuestoBuscado.setEditable(false);
							btnBuscarPresupuesto.setEnabled(false);
						}
					}
				}
			};
		}
		return abstractAction1;
	}

//	private AbstractAction getAbstractAction2() {
//		if(abstractAction2 == null) {
//			abstractAction2 = new AbstractAction("Modificar item", null) {
//				/**
//				 * 
//				 */
//				private static final long serialVersionUID = 1L;
//
//				public void actionPerformed(ActionEvent evt) {
//					/*
//					 * 		Action Listener del boton Modificar Item
//					 */
//					if(txtNroItem.isEditable() == false){
//						txtNroItem.setEditable(true);
//						txtCantidad.setEditable(false);
//						txtPrecioUnitario.setEditable(false);
//						txtDescripcion.setEditable(false);
//					}
//					else
//					{
//						JOptionPane.showMessageDialog(null, "Comienzo a editar el item" + txtNroItem.getText());
//						txtNroItem.setEditable(false);
//						txtCantidad.setEditable(true);
//						txtPrecioUnitario.setEditable(true);
//						txtDescripcion.setEditable(true);
//					}
//				}
//			};
//		}
//		return abstractAction2;
//	}

//	private AbstractAction getAbstractAction3() {
//		if(abstractAction3 == null) {
//			abstractAction3 = new AbstractAction("Borrar item", null) {
//				/**
//				 * 
//				 */
//				private static final long serialVersionUID = 1L;
//
//				public void actionPerformed(ActionEvent evt) {
//					/*
//					 * 		Action Listener del boton Borrar Item
//					 */
//				}
//			};
//		}
//		return abstractAction3;
//	}

		
	
	private AbstractAction getAbstractAction6() {
		if(abstractAction6 == null) {
			abstractAction6 = new AbstractAction("Cancelar", null) {
				/**
				 * Action Listener del boton "Cancelar"
				 */
				private static final long serialVersionUID = 1L;

				public void actionPerformed(ActionEvent evt) {
					dispose();
				}
			};
		}
		return abstractAction6;
	}

	private AbstractAction getAbstractAction7() {
		if(abstractAction7 == null) {
			abstractAction7 = new AbstractAction("Aceptar", null) {
				/**
				 * Action Listener del boton "Aceptar"
				 */
				private static final long serialVersionUID = 1L;

				public void actionPerformed(ActionEvent evt) {
										
					// Veo que esten los datos que preciso
					if (txtNumeroPresupuesto.getText().equals("")){
						JOptionPane.showMessageDialog(null, "Debe de ingresar el numero de presupuesto");
						return;
					}
					
					// Actualizo el estado del presupuesto
					ControladorAdministradorPresupuestos controlador = new ControladorModificarPresupuestoFrame();
					controlador.modificarPresupuesto(presupuestoEncontrado, cmbCondicionPresupuesto.getSelectedItem().toString());
					// Informo finalizacion proceso
					JOptionPane.showMessageDialog(null, "Presupuesto actualizado correctamente");
					dispose();
				}
			};
		}
		return abstractAction7;
	}

	private JPanel getPanelListadoItems() {
		if(PanelListadoItems == null) {
			PanelListadoItems = new JPanel();
			FlowLayout PanelListadoItemsLayout = new FlowLayout();
			PanelListadoItems.setBorder(BorderFactory.createTitledBorder("Listado de items"));
			PanelListadoItems.setLayout(PanelListadoItemsLayout);
			PanelListadoItems.add(getJScrollPane1());
		}
		return PanelListadoItems;
	}

	private JLabel getLblNumeroPresupuesto() {
		if(lblNumeroPresupuesto == null) {
			lblNumeroPresupuesto = new JLabel();
			lblNumeroPresupuesto.setText("Numero de Presupuesto: ");
		}
		return lblNumeroPresupuesto;
	}
	
	private JTextField getTxtNumeroPresupuesto() {
		if(txtNumeroPresupuesto == null) {
			txtNumeroPresupuesto = new JTextField();
			txtNumeroPresupuesto.setEditable(false);
		}
		return txtNumeroPresupuesto;
	}

	private JLabel getJLabel1x() {
		if(jLabel1 == null) {
			jLabel1 = new JLabel();
			jLabel1.setText("Cantidad");
		}
		return jLabel1;
	}

	private JTextArea getTextAreaListadoItems() {
		if(textAreaListadoItems == null) {
			textAreaListadoItems = new JTextArea();
			textAreaListadoItems.setPreferredSize(new java.awt.Dimension(565, 113));
		}
		return textAreaListadoItems;
	}
	
	private void actualizarListado(Vector<ItemPresupuesto> listadoItems){
		textAreaListadoItems.setText("");
		textAreaListadoItems.append("NroItem\tDescripcion\t\t\tCantidad\tPrecio Unitario\tTotal Item\n");
		for(int i = 0; i < listadoItems.size(); i++){
			textAreaListadoItems.append(listadoItems.elementAt(i).toString());
		}
		// Actualizo el total de la factura
		float totalPresupuesto = 0;
		for (ItemPresupuesto item : listadoItemsPresupuesto){
			totalPresupuesto += item.getTotalItem();
		}
		txtTotalPresupuesto.setText(String.valueOf(totalPresupuesto));
	}
	
	private JScrollPane getJScrollPane1() {
		if(jScrollPane1 == null) {
			jScrollPane1 = new JScrollPane();
			jScrollPane1.setPreferredSize(new java.awt.Dimension(703, 119));
			jScrollPane1.setViewportView(getTextAreaListadoItems());
		}
		return jScrollPane1;
	}

		
	private JLabel getLblCondicionPresupuesto() {
		if(lblCondicionPresupuesto == null) {
			lblCondicionPresupuesto = new JLabel();
			lblCondicionPresupuesto.setText("Condicion Presupuesto");
		} 
		return lblCondicionPresupuesto;
	}
	
	private JComboBox getCmbCondicionPresupuesto() {
		if(cmbCondicionPresupuesto == null) {
			cmbCondicionPresupuesto = new JComboBox();
			ControladorAdministradorPresupuestos controladorEstadosPresupuestos = new ControladorGenerarPresupuesto();
			Vector<String> estadosPresupuestos = controladorEstadosPresupuestos.obtenerEstadosPresupuestos();
			for(String estadoPresupuesto : estadosPresupuestos){
				cmbCondicionPresupuesto.addItem(estadoPresupuesto);
			}
		}
		return cmbCondicionPresupuesto;
	}

}